#include <iostream>
#include <cstdio>
using namespace std;
int main() {
	char s[200], a, b, c;
	int n = 0;
	while ((s[n++] = getchar()) != '\n');
	cin >> a >> b;
	for (int i = 0; i < n; i++) {
		c = s[i];
		if (c == a) {
			cout << b;
		} else {
			cout << c;
		}
	}
	return 0;
}
